package com.mes.warehouse.controller;

import com.mes.common.pojo.MESResult;
import com.mes.pojo.warehouse.WarehouseLocation;
import com.mes.warehouse.server.WarehouseLocationServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 张喆
 * @Company
 * @Description
 * @Time 2024/10/25 16:56
 */
@RestController
@CrossOrigin
@RequestMapping("/warehouseLocation")
public class WarehouseLocationController {
    @Autowired
    private WarehouseLocationServer warehouseLocationServer;
    @GetMapping("/list")
    public MESResult list(WarehouseLocation warehouseLocation, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer limit){
        return warehouseLocationServer.queryAll(warehouseLocation,pageNum,limit);
    }
    @GetMapping("/updateInfo")
    public MESResult updateInfo(String warehouseLocationId,String warehouseAreaId){
        return warehouseLocationServer.queryById(warehouseLocationId,warehouseAreaId);
    }
    @DeleteMapping("/delete")
    public MESResult delete(String warehouseLocationId,String warehouseAreaId){
        return  warehouseLocationServer.deleteWarehouseLocation(warehouseLocationId,warehouseAreaId);
    }
    @PutMapping("/update")
    public MESResult update(@RequestBody WarehouseLocation warehouseLocation){
        return warehouseLocationServer.updateWarehouseLocation(warehouseLocation);
    }
    @PostMapping("/insert")
    public MESResult insert(@RequestBody WarehouseLocation warehouseLocation){
        return warehouseLocationServer.insertWarehouseLocation(warehouseLocation);
    }
}
